from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By

class Browser:
    driver = None
    base_url = None

def setUpModule():
    Browser.driver = webdriver.Chrome()
    Browser.base_url = "https://www.baidu.com"

def tearDownModule():
    Browser.driver.quit()

def baidu_search(search_key):
    Browser.driver.get(Browser.base_url)
    Browser.driver.find_element(By.CSS_SELECTOR, "#kw").send_keys(search_key)
    Browser.driver.find_element(By.CSS_SELECTOR, "#su").click()
    sleep(2)